1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.SwipeableT; 26 27 public import adw.c.functions; 28 public import adw.c.types; 29 30 31 /** 32 * An interface for swipeable widgets. 33 * 34 * The `AdwSwipeable` interface is implemented by all swipeable widgets. 35 * 36 * See [class@SwipeTracker] for details about implementing it. 37 * 38 * Since: 1.0 39 */ 40 public template SwipeableT(TStruct) 41 { 42 /** Get the main Gtk struct */ 43 public AdwSwipeable* getSwipeableStruct(bool transferOwnership = false) 44 { 45 if (transferOwnership) 46 ownedRef = false; 47 return cast(AdwSwipeable*)getStruct(); 48 } 49 50 51 /** 52 * Gets the progress @self will snap back to after the gesture is canceled. 53 * 54 * Returns: the cancel progress, unitless 55 * 56 * Since: 1.0 57 */ 58 public double getCancelProgress() 59 { 60 return adw_swipeable_get_cancel_progress(getSwipeableStruct()); 61 } 62 63 /** 64 * Gets the swipe distance of @self. 65 * 66 * This corresponds to how many pixels 1 unit represents. 67 * 68 * Returns: the swipe distance in pixels 69 * 70 * Since: 1.0 71 */ 72 public double getDistance() 73 { 74 return adw_swipeable_get_distance(getSwipeableStruct()); 75 } 76 77 /** 78 * Gets the current progress of @self. 79 * 80 * Returns: the current progress, unitless 81 * 82 * Since: 1.0 83 */ 84 public double getProgress() 85 { 86 return adw_swipeable_get_progress(getSwipeableStruct()); 87 } 88 89 /** 90 * Gets the snap points of @self. 91 * 92 * Each snap point represents a progress value that is considered acceptable to 93 * end the swipe on. 94 * 95 * Returns: the snap points 96 * 97 * Since: 1.0 98 */ 99 public double[] getSnapPoints() 100 { 101 int nSnapPoints; 102 103 auto __p = adw_swipeable_get_snap_points(getSwipeableStruct(), &nSnapPoints); 104 105 return __p[0 .. nSnapPoints]; 106 } 107 108 /** 109 * Gets the area @self can start a swipe from for the given direction and 110 * gesture type. 111 * 112 * This can be used to restrict swipes to only be possible from a certain area, 113 * for example, to only allow edge swipes, or to have a draggable element and 114 * ignore swipes elsewhere. 115 * 116 * If not implemented, the default implementation returns the allocation of 117 * @self, allowing swipes from anywhere. 118 * 119 * Params: 120 * navigationDirection = the direction of the swipe 121 * isDrag = whether the swipe is caused by a dragging gesture 122 * rect = a pointer to a rectangle to store the swipe area 123 * 124 * Since: 1.0 125 */ 126 public void getSwipeArea(AdwNavigationDirection navigationDirection, bool isDrag, out GdkRectangle rect) 127 { 128 adw_swipeable_get_swipe_area(getSwipeableStruct(), navigationDirection, isDrag, &rect); 129 } 130 }